package com.fbinggun.fbinggunutil.statistics.datatype;

import com.alibaba.fastjson.JSONObject;
import com.fbinggun.fbinggunutil.statistics.StatisticsInfo;

public class BooleanInfo extends StatisticsInfo<Boolean> {
    public BooleanInfo(String id, Boolean v) {
        super(id, v);
    }

    public BooleanInfo(String id, JSONObject jsonObject) {
        super(id, jsonObject);
    }

    @Override
    protected StatisticsInfo copy(String id, JSONObject jsonObject) {
        return new BooleanInfo(id,jsonObject);
    }

    @Override
    protected StatisticsInfo copy(String id, Boolean booleanInfo) {
        return new BooleanInfo(id,booleanInfo);
    }


    @Override
    protected void addSValue(String v) {
        try {
            t=Boolean.parseBoolean(v);
        }catch (Exception e) {
            t=false;
        }

    }

    @Override
    protected void setSValue(String value) {
        try {
            t=Boolean.parseBoolean(value);
        }catch (Exception e) {
            t=false;
        }
    }

    @Override
    protected void addValue(Boolean aBoolean) {
        t=aBoolean;
    }

    @Override
    public String getPlaceholder() {
        return String.valueOf(getValue());
    }
}
